/*
package org.meichao.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;

*/
/**
 * 默认redis，可继承RedisConfig类来实现多Redis
 *//*

@Configuration
@EnableCaching
public class DefaultRedisConfig extends RedisConfig{

    @Value("${spring.redis.database}")
    private int index;

    @Value("${spring.redis.host}")
    private String  host;

    @Value("${spring.redis.port}")
    private int port;

    @Value("${spring.redis.timeout}")
    private int timeOut;

    @Value("${spring.redis.password}")
    private String passWord;

    */
/**
     * 多Redis数据源需要用@Primary确定优先执行哪个
     * @return
     *//*

    @Primary
    @Bean(name = "defaulteConnectionFactory")
    public JedisConnectionFactory defaultRedisConnectionFactory(){
        return jedisConnectionFactory(index, host, port, timeOut, passWord);
    }

    @Primary
    @Bean(name = "stringRedisTemplate")
    public StringRedisTemplate stringRedisTemplate(){
        StringRedisTemplate template = new StringRedisTemplate();
        template.setConnectionFactory(defaultRedisConnectionFactory());
        template.afterPropertiesSet();
        return template;
    }
}
*/
